package com.lhl.gencode.auditing;

import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

/**
 * @className: JpaAuditingHandlerRegistrar
 * @description: TODO 类描述
 * @author: king
 * @date: 2020-09-15 9:37
 **/
public class JpaAuditingHandlerRegistrar implements ImportBeanDefinitionRegistrar {
    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        registry.registerBeanDefinition("jpaAuditingHandler", BeanDefinitionBuilder
                .rootBeanDefinition(JpaAuditingHandler.class)
                .addConstructorArgReference("jpaMappingContext")
                .getBeanDefinition());
    }
}